package com.tjsinfo.tjsoa.vote.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.tjsinfo.tjsoa.vote.bo.ITVoteColumnBO;
import com.tjsinfo.tjsoa.vote.bo.ITVoteConformationBO;
import com.tjsinfo.tjsoa.vote.bo.ITVoteEstimatedBO;
import com.tjsinfo.tjsoa.vote.bo.ITVoteHeadBO;

public class HeadDelAction extends Action {
	private ITVoteHeadBO headBo;
	private ITVoteConformationBO conformationBo;
	private ITVoteColumnBO columnBo;
	private ITVoteEstimatedBO estimatedBo;
	public void setHeadBo(ITVoteHeadBO headBo) {
		this.headBo = headBo;
	}
	public void setConformationBo(ITVoteConformationBO conformationBo) {
		this.conformationBo = conformationBo;
	}
	public void setColumnBo(ITVoteColumnBO columnBo) {
		this.columnBo = columnBo;
	}
	public void setEstimatedBo(ITVoteEstimatedBO estimatedBo) {
		this.estimatedBo = estimatedBo;
	}
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		try {
			String headId = request.getParameter("headId");
			headBo.delete(headId);
			estimatedBo.deleteA(headId);
			columnBo.deleteA(headId);
			conformationBo.deleteA(headId);
			
			request.setAttribute("linkurl", "tjsinfo/tjsoa/vote/headList.do");
			request.setAttribute("message", "vote.headDel.message");				
			
			return mapping.findForward("success");
		} catch (Exception e) {
			e.printStackTrace();
			return mapping.findForward("failed");
		}
	}
}